package org.wanho;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Author：汤小洋
 * Date：2023-05-08 16:42
 * Description：<描述>
 */
public class Emp {
    private String name;
    private Integer age;
    private Double salary; // 工资
    private State state; // 状态

    public Emp() {
    }

    public Emp(String name, Integer age, Double salary, State state) {
        this.name = name;
        this.age = age;
        this.salary = salary;
        this.state = state;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return "Emp{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", salary=" + salary +
                ", state=" + state +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Emp emp = (Emp) o;
        return Objects.equals(name, emp.name) &&
                Objects.equals(age, emp.age) &&
                Objects.equals(salary, emp.salary) &&
                state == emp.state;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, salary, state);
    }

    /**
     * 测试数据
     */
    public static List<Emp> getTestData(){
        List<Emp> list = new ArrayList<>();
        list.add(new Emp("张一",68,2400.00,State.FREE));
        list.add(new Emp("张二",28,7500.00,State.VOCATION));
        list.add(new Emp("张三",39,2400.00,State.BUSY));
        list.add(new Emp("张四",16,7500.00,State.BUSY));
        list.add(new Emp("张五",28,9400.00,State.VOCATION));
        list.add(new Emp("aaa",22,2600.00,State.BUSY));
        list.add(new Emp("bbb",12,2600.00,State.BUSY));
        list.add(new Emp("ccc",25,2600.00,State.FREE));
        list.add(new Emp("ddd",24,2800.00,State.BUSY));
        list.add(new Emp("eee",25,2600.00,State.BUSY));
        list.add(new Emp("fff",22,2600.00,State.FREE));
        list.add(new Emp("ggg",29,2600.00,State.BUSY));
        list.add(new Emp("hhh",22,6900.00,State.VOCATION));
        list.add(new Emp("iii",22,2600.00,State.FREE));
        list.add(new Emp("jjj",32,2600.00,State.FREE));
        list.add(new Emp("kkk",29,2600.00,State.VOCATION));
        list.add(new Emp("lll",21,2800.00,State.VOCATION));
        list.add(new Emp("mmm",21,6900.00,State.BUSY));
        list.add(new Emp("mmm",21,6900.00,State.BUSY));
        list.add(new Emp("mmm",21,6900.00,State.BUSY));
        return list;
    }

}
